package o;

import androidx.annotation.MainThread;
import androidx.annotation.NonNull;

public class lf {
    private final lh ˊ;
    private final e ॱ;

    public interface e {
        @NonNull
        <T extends lc> T ˏ(@NonNull Class<T> cls);
    }

    static abstract class d implements e {
        @NonNull
        public abstract <T extends lc> T ॱ(@NonNull String str, @NonNull Class<T> cls);

        d() {
        }
    }

    public lf(@NonNull lh lhVar, @NonNull e eVar) {
        this.ॱ = eVar;
        this.ˊ = lhVar;
    }

    @MainThread
    @NonNull
    public <T extends lc> T ˋ(@NonNull Class<T> cls) {
        String canonicalName = cls.getCanonicalName();
        if (canonicalName != null) {
            return ˎ("androidx.lifecycle.ViewModelProvider.DefaultKey:" + canonicalName, cls);
        }
        throw new IllegalArgumentException("Local and anonymous classes can not be ViewModels");
    }

    @MainThread
    @NonNull
    public <T extends lc> T ˎ(@NonNull String str, @NonNull Class<T> cls) {
        T ˊ = this.ˊ.ˊ(str);
        if (!cls.isInstance(ˊ)) {
            if (ˊ != null) {
            }
            if (this.ॱ instanceof d) {
                ˊ = ((d) this.ॱ).ॱ(str, cls);
            } else {
                ˊ = this.ॱ.ˏ(cls);
            }
            this.ˊ.ˎ(str, ˊ);
        }
        return ˊ;
    }
}
